package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController(value = "adminShopController")
@RequestMapping("/admin/shop")
@Slf4j
public class ShopController {

    @Autowired
    private ShopService shopService;

    /**
     * 获取营业状态
     *
     * @return
     */
    @GetMapping("/status")
    public Result getStatus() {
        Integer shopStatus = shopService.getStatus();
        return Result.success(shopStatus);
    }

    /**
     * 设置当前营业状态
     *
     * @param status
     * @return
     */
    @PutMapping("/{status}")
    public Result setStatus(@PathVariable Integer status) {
        shopService.setStatus(status);

        return Result.success();
    }
}
